﻿/*
培训任务的添加修改
*/
//
angular.module('jisuStuHome')
 .directive("addImgCj", ["Msg", "$rootScope", "sysUserInfo", function (Msg, $rootScope, sysUserInfo) {
     return {
         restrice: "AE",
         scope: {
             onClose: "&"
         },
         templateUrl: "/member/directive/interlocution/add_img_cj.html",
         link: function (scope, element, attr) {

             scope.userinfo = sysUserInfo.getuserinfo();
             scope.closeImgCj = function () {
                 scope.userinfo = sysUserInfo.getuserinfo();
                 //回显原始图
                 if (scope.userinfo.userContact != undefined && scope.userinfo.userContact.facePhoto != undefined) {
                     scope.onClose();
                 } else {
                     Msg.warning("请先完成图像采集！");
                 }
             }
             var flashvars = {
                 uid: scope.userinfo.user_ID,
                 xid: scope.userinfo.user_ID,
                 xtype: "3",
                 isContrast: false,
                 url: commonUrl + "/face/saveface"
             };
             setTimeout(function () {
                 var fls = flashChecker();
                 if (fls.f) {
                     swfobject2.embedSWF("/framework/photo/index.swf", "photoframe", "40%", "300", "9.0.0", "/framework/photo/expressInstall.swf", flashvars);
                 } else {
                     alert("您的浏览器没有安装flash");
                 };

             }, 2000);
             //facePhoto
             scope.imgsrc = "/images/avatar.png";
             //回显原始图
             if (scope.userinfo.userContact != undefined && scope.userinfo.userContact.facePhoto != undefined) {
                 scope.imgsrc = scope.userinfo.userContact.facePhoto + "?data=" + new Date();
             }
             //退出
             scope.exitSystem = function () {
                 localStorage.clear();
                 location.href = "/login.html";
             }
         }
     }
 } ]);
